import * as core from "@babel/core";

import presetEnv from "@babel/preset-env";
import fs from "fs";

const file = fs.readFileSync("./index.jsx", "utf8");
import reactPreset from "@babel/preset-react";
const result = core.transform(file, {
  // 需要配置参数时候，需要用两个数组
  presets: [
    [presetEnv, { useBuiltIns: "usage", corejs: 3 }],
    reactPreset,
  ],
});

console.log(result.code);
